package ro.ubbcluj.cs.damate.persistence.repository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import ro.ubbcluj.cs.damate.persistence.entities.File;

/**
 * @author Lóránd Fazakas (lorand)
 *         Date: 5/10/12
 *         Time: 9:25 PM
 */
public interface FileRepository extends CrudRepository<File, Long> {

    @Query("select f from File f inner join f.project p inner join p.workspaces w where f.path = ?1 and f.type = ?2 and p.name = ?3 and w.ipAddress = ?4 and w.path = ?5")
    File findFile(String filePath, Integer type, String projectName, String ip, String workspacePath);
}
